﻿Public Class ChangePassWord_Page
    Dim Main As Object
    Sub SetWindow(ByVal _Main As Object)
        Main = _Main
    End Sub
    Public Sub Initialize()
        PasswordBoxOld.Password = ""
        PasswordBoxNew1.Password = ""
        PasswordBoxNew2.Password = ""
    End Sub

    Private Sub ButtonOK_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles ButtonOK.Click
        If (PasswordBoxNew1.Password = PasswordBoxNew2.Password And PasswordBoxNew1.Password <> "") Then
            Try
                If SysManage.passwordmanage(GlobalClass.UserId, PasswordBoxOld.Password, PasswordBoxNew1.Password) Then
                    MsgBox("修改成功!")
                    Dim Window As New Login
                    Window.Show()
                    Main.Hide()
                End If
            Catch err As Exception
                MsgBox(err.Message)
            End Try
        Else
            MsgBox("两次输入的密码不一致!")
        End If
    End Sub

    Private Sub ButtonReSet_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles ButtonReSet.Click
        Initialize()
    End Sub

    Private Sub ChangePassWord_Page_KeyDown(sender As Object, e As System.Windows.Input.KeyEventArgs) Handles Me.KeyDown
        If e.Key = Key.Return Then ButtonOK_Click(sender, New RoutedEventArgs)
    End Sub
End Class
